import sys
sys.path.append('../kernel')
from model import Model
class TasklogModel(Model):
    def __init__(self):
        self.table = 'cg_task_log'
        #链接数据库
        super().__init__()
    #获取任务数据
    def insert_log(self,params):
        sql = "INSERT INTO " + self.table + " SET t_id=%s,info=%s,creation_time=%s"
        self.cursor.execute(sql, [params['t_id'],params['info'],params['creation_time']])
        self.conn.commit()  # 提交
    def __del__(self):
        #计数数据库链接
        self.cursor.close()
        self.conn.close()